var cc__importDefault = __importDefault;
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.PosTool = undefined;
var $1$zqcc_OverallSystem = require("zqcc_OverallSystem");
var i = cc__importDefault($1$zqcc_OverallSystem);
var exp_PosTool = function () {
  function _ctor() { }
  _ctor.prototype.rootPosToTargetNodeSpace = function (t, e) {
    var o = t.convertToWorldSpaceAR(cc.v2(0, 0));
    return e.convertToNodeSpaceAR(o);
  };
  _ctor.prototype.distancesBetweenTwoPostion = function (t, e) {
    return t.sub(e).mag();
  };
  _ctor.prototype.screenScope = function (t) {
    // 将节点的局部坐标转换为世界坐标
    const worldPosition = t.node.convertToWorldSpaceAR(cc.v2(0, 0));

    // 根据缩放比计算画布的宽度和高度
    const width = i.default.Canvas().width / t.zoomRatio;
    const height = i.default.Canvas().height / t.zoomRatio;

    // 返回以世界坐标和画布尺寸创建的矩形
    return cc.rect(worldPosition.x, worldPosition.y, width, height);
  };
  _ctor.prototype.inTheScreen = function (t, e) {
    // 获取屏幕范围
    const screenBounds = this.screenScope(t);

    // 检查点 e 是否在屏幕范围内
    return (
      e.x <= screenBounds.x + screenBounds.width / 2 &&
      e.x >= screenBounds.x - screenBounds.width / 2 &&
      e.y <= screenBounds.y + screenBounds.height / 2 &&
      e.y >= screenBounds.y - screenBounds.height / 2
    );
  };
  _ctor.prototype.getNodeWordPos = function (t) {
    return t.convertToWorldSpaceAR(cc.v2(0, 0));
  };
  return _ctor;
}();
exports.PosTool = exp_PosTool;